<div class="actions">
  <ul>
    <li><?php echo $html->link(__('New Ballot', true), array('action' => 'view')); ?></li>
  </ul>
</div>
<div class="ballots index">
<h2><?php __('Saved Ballots');?></h2>
<p>
<?php
echo $paginator->counter(array(
'format' => __('You have %count% saved ballots, showing from %start% to %end%', true)
));
?></p>
<table class="ballotIndexTable" cellpadding="0" cellspacing="0">
<tr>
  <th width="80px"><?php echo $paginator->sort('ID');?></th>
  <th width="150px"><?php echo $paginator->sort('zip code');?></th>
	<th width="200px"><?php echo $paginator->sort('Vote Date');?></th>
  <th width="250px"><?php echo $paginator->sort('last updated');?></th>
	<th width="200px" class="actions"><?php __('Actions');?></th>
</tr>
<?php
$i = 0;
foreach ($ballots as $ballot):
	$class = null;
	if ($i++ % 2 == 0) {
		$class = ' class="altrow"';
	}
	$ballotData = unserialize($ballot['Ballot']['ballot_data']);
?>
	<tr<?php echo $class;?>>
    <td>
      <?php echo $ballot['Ballot']['id']; ?>
    </td>
    <td>
      <?php echo $ballot['Ballot']['zip']; if (!empty($ballot['Ballot']['plus4'])): echo '-'.$ballot['Ballot']['plus4']; endif;?>
    </td>
    <td>
			<?php echo $ballot['Ballot']['vote_date']; ?>
		</td>
    <td>
      <?php echo $ballot['Ballot']['updated']; ?>
    </td>
		<td class="actions">
		  <?php echo $html->link(__('Select', true), array('action' => 'select', $ballot['Ballot']['id'])); ?>
			<?php echo $html->link(__('View', true), array('action' => 'view', $ballot['Ballot']['id'])); ?>
			<?php echo $html->link(__('Delete', true), array('action' => 'delete', $ballot['Ballot']['id']), 
			     null, sprintf(__('Are you sure you want to delete #%s ballot with ZIP %s?', true), 
			                   $ballot['Ballot']['id'], $ballotData['zip'])); ?>
		</td>
	</tr>
<?php endforeach; ?>
</table>
</div>
<div class="paging">
	<?php echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>
 | 	<?php echo $paginator->numbers();?>
	<?php echo $paginator->next(__('next', true).' >>', array(), null, array('class' => 'disabled'));?>
</div>
